﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DcsGauges.Gui.Gauges.Interfaces;
using DcsGauges.Shared.DataStructures;

namespace DcsGauges.Data
{
    class MultiValueDataConnector : IDataConnector
    {
        protected IMultiValueGauge          gauge           = null;
        protected IDcsA10DataModel          dataModel       = null;
        protected List<DcsProperty>        properties      = null;


        public MultiValueDataConnector(IMultiValueGauge gauge, IDcsA10DataModel dataModel)
        {
            this.gauge                  = gauge;
            this.dataModel              = dataModel;
            this.properties             = gauge.Properties.ToList();
        }


        public void Update()
        {
            foreach(DcsProperty prop in this.properties)
            {
                gauge.SetValue(prop, dataModel.GetProperty(prop));
            }
        }

    }
}
